package org.okcjug.december.set;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Test;

import junit.framework.Assert;

public class MyHashSet{
	@Test
	public void removeDupes(){
		List<String> firstNames = new ArrayList<String>();
		Collections.addAll(firstNames, 
				"Paul", "John", "Ringo", "George", "Pete",
				"Paul", "Paul", "John");
		Set<String> noDupes = new HashSet<String>(firstNames);
		int paulCounter = 0;
		for(String name : noDupes){
			if(name.equals("Paul"))
				paulCounter++;
		}
		Assert.assertTrue(paulCounter == 1);
	}	
}

